function GetCookie(name) {
	try {
	    var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
	    if (arr != null) return unescape(arr[2]); return null;
	} catch (e) {
		return null;
	}
};

/*function SetCookie(name,value)
{ 
    var Days = 30; 
    var exp = new Date(); 
    exp.setTime(exp.getTime() + Days*24*60*60*1000); 
    document.cookie = name + "="+ escape(value) + ";expires=" + exp.toGMTString(); 
} */

// 创建ajax对象
function NetWorker() {
};
NetWorker.prototype.doGet = function(url, callback) {
	this.req = new XMLHttpRequest();
	var cookies= "cookies="+escape(document. cookie);
	this.req.open("GET",url,true);
	//this.req.setRequestHeader("contentType","text/html;charset=uft-8");
	this.req.onreadystatechange = callback;
	this.req.send(cookies);
};
NetWorker.prototype.doPost = function(url,param, callback) {
	this.req = new XMLHttpRequest();
	this.req.open("POST", url, true);
	this.req.setRequestHeader("content-Type","application/json;charset=uft-8");
//	this.req.setRequestHeader("contentType","text/html;charset=uft-8");
//	this.req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
	this.req.onreadystatechange = callback;
	this.req.send(param);
};

var fpArr=[];
var nets=[];
function doGet(urll,funn,fp,fi){//访问路径,返回调用方法名,方法中参数,net对象及参数暂存位置
	var obj=new NetWorker();
	var isNum=/^\d+$/;
	if(isNum.test(fi)){
		fpArr[parseInt(fi)]=fp;
		nets[parseInt(fi)]=obj;
		obj.doGet(urll,funn);
	}
 }

//返回处理方式
//function gettq(){
//	   if(nets[0].req.readyState==4){
//			if(nets[0].req.status==200){
//				var res =  nets[0].req.responseText;
//				res=eval("("+res+")");
//				if(res){
//					settq(res);
//				}
//			}
//	   }
//}
//function settq(ifo){
//		var param="";
//		if(fpArr[0]){
//			param=fpArr[0]+"";
//		}
//}



var alertidd="";
var toTurn="2";
var toTurnUrl="";
var isAlert;
var backurltmp="";
function alertm(idd,ttt){
	backurltmp=backurl+"";
	backurl="javascript:closem();";
	if(""!=idd){
		alertidd=idd;
	}
	$("btns").style.display="none";
	$c("alert").style.display="block";
	$c("almes").innerHTML=ttt;
	if($c("trueb")){
		$c("trueb").focus();
	}
	if(ttt.indexOf("img")!=-1){
		$c("almes").className="almes almes1";
	}else{
		$c("almes").className="almes";
	}
}
var tempFun=null;
var tempParm=null;
function alertm0(idd,ttt,fff,ppp){
	backurltmp=backurl+"";
	backurl="javascript:closem0();";
	if(fff){
		tempFun=fff;
	}else{
		tempFun=null;
	};
	if(ppp){
		tempParm=ppp;
	}else{
		tempParm=null;
	};
	if(""!=idd){
		alertidd=idd;
	}
	$("btns").style.display="none";
	$c("alert0").style.display="block";
	$c("almes0").innerHTML=ttt;
	if ($c("trueb0")) {
		$c("trueb0").focus();
	}
}

function closem(tot){
	if(backurltmp!=""){
		backurl=backurltmp+"";
	}
	if(toTurn=="1"){
		window.location.href=toTurnUrl;
	}else{
		$("btns").style.display="block";
		if(""!=alertidd){
			$c(alertidd).focus();
		}
		$c("alert").style.display="none";
	}
}
function closem0(tot){
	if(backurltmp!=""){
		backurl=backurltmp+"";
	}
	if(toTurn=="1"){
		window.location.href=toTurnUrl;
	}else{
		$("btns").style.display="block";
		if(""!=alertidd){
			$c(alertidd).focus();
		}
		$c("alert0").style.display="none";
		if(tot==1){
			if(tempFun!=null&&tempParm!=null){
				tempFun(tempParm);
			}else if(tempFun!=null){
				tempFun();
			}
		}
	}
}
var alertiddw="";
function alertw(idd,ttt){
	if(""!=idd){
		alertiddw=idd;
	}
	$("btns").style.display="none";
	$c("wait").style.display="block";
	$c("almesw").innerHTML=ttt;
}
function closew(){
	$("btns").style.display="block";
	$c("wait").style.display="none";
	if(""!=alertidd){
		$c(alertiddw).focus();
	}
}
function setAlertFoc(){
	if($c("alert")){
		getFcd($c("alert"));
		setFocPicc("trueb", "truef");
	}
	if($c("alert0")){
		setFocPicc("trueb0", "truef0");
		setFocPicc("falseb0", "falsef0");
	}
}


